<?php
/**
 * Created by PhpStorm.
 * User: yuguozhen
 * Date: 16/7/22
 * Time: 下午2:22
 */
namespace models\Timer\Count;
class HospitalModel extends \models\HospitalModel{

    /**
     * 新增的医院数量
     * @param $prev_start  开始时间
     * @param $prev_end  结束时间
     * @return mixed  数量
     */
    public function NEW_HOSPITAL($prev_start,$prev_end){
        $count = $this->where('CREATE_TIME','>=',$prev_start)
            ->where('CREATE_TIME','<',$prev_end)
            ->count();

      //  $sql = "select count(1) from `hospital` where CREATE_TIME >= ".$prev_start." and CREATE_TIME<=".$prev_end;
//        $errpath = $this->config->logs->exec_timer_static_sql;
//        $this->monolog('exec_sql_static',$errpath,$level=\Monolog\Logger::INFO,$content=$sql,$slevel='info');

        return $count;
    }

    public function ALL_HOSPITAL($now_end=""){
        if(empty($now_end)){
            $now_end = date("Y-m-d H:i:s",$this->time);
        }
        $count = $this->where('create_time','<',$now_end)
            ->where('VALID_FLAG','=','ENABLE')
            ->count();

      //  $sql = "select count(1) from `hospital` where create_time < ".$now_end." and VALID_FLAG = ENABLE";
//        $errpath = $this->config->logs->exec_timer_static_sql;
//        $this->monolog('exec_sql_static',$errpath,$level=\Monolog\Logger::INFO,$content=$sql,$slevel='info');

        return $count;
    }
}